﻿/*-------------------------------------------------------------------------
* 命名空间: ScreenCapture.Loc/LanguageFields
* 类       名: LanguageFields
* 功      能:  TD
* 时      间:  2023/12/1 14:28:17
* 版      本:  V1.0
* 作      者:  Fioman
* 格      言:  Talk is cheap,show me the code ^_^
*-------------------------------------------------------------------------*/
using ScreenCapture.Base;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Text;

namespace ScreenCapture.Loc
{
    /// <summary>
    /// UI 用于显示UI界面中文字的父类模型类
    /// </summary>
    public class LanguageFields : NotifyPropertyChanged, ILocalizationProvider
    {
        // 这个方法要重写的额,如果不重写默认返回空字符串
        // 根据索引器去访问属性的值,就是其父类要实现索引器
        protected virtual string GetValue(string Key) => "";
        protected virtual void SetValue(string Key, string Value) { }

        // Get方法封装
        private string Get([CallerMemberName] string PropertyName = null)
        {
            return GetValue(PropertyName);
        }
        // Set方法封装
        private void Set(string Value, [CallerMemberName] string PropertyName = null)
        {
            SetValue(PropertyName, Value);
            RaisePropertyChanged(PropertyName);
        }

        // 语言更改事件,当语言发生改变的时候触发这个事件
        public virtual event Action<CultureInfo> LanguageChangedEvent;

        public string ErrorOccurred
        {
            get => Get();
            set => Set(value);
        }

        public string FFmpegLog
        {
            get => Get();
            set => Set(value);
        }

        public string CopyToClipboard
        {
            get => Get();
            set => Set(value);
        }

        public string ViewDetails
        {
            get => Get();
            set => Set(value);
        }

        public string Close
        {
            get => Get();
            set => Set(value);
        }

        public string ScreenCapture
        {
            get => Get();
            set => Set(value);
        }
    }
}
